public class Demo21 {
    public static void main(String[] args) {
        int[] arr={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
        System.out.println(stringb(arr));
    }

    public static String stringb(int[] arr){
        StringBuilder str=new StringBuilder("[");
        for (int i = 0; i < arr.length; i++) {
            if(i==arr.length-1){
                str.append(arr[i]).append("]");
            }else{
                str.append(arr[i]).append(", ");
            }
        }
        return str.toString();
    }
}
